const key = "userInfo";

export const setUserInfo = <T>(value: T): void => {
    localStorage.setItem(key, JSON.stringify(value));
};

export const getUserInfo = <T>():T => {
    try {
        return JSON.parse(localStorage.getItem(key) as any);
    } catch (error) {
        return <T>{};
    }
};

export const removeUserInfo = ():void => {
    localStorage.removeItem(key);
};
